package it.gameplanet.service;

import it.gameplanet.model.Articolo;
import it.gameplanet.model.Categoria;
import it.gameplanet.model.News;
import it.gameplanet.model.User;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("service")
public interface GamePlanetService extends RemoteService {

	public static class Utils {
		private final static GamePlanetServiceAsync gamePlanetService = GWT
		.create(GamePlanetService.class);

		public static GamePlanetServiceAsync getGamePlanetServiceAsync() {
			return gamePlanetService;
		}
	}
	
	List<Articolo> findArticoliByCategoria(final Categoria categoria);
	
	void inserisciArticolo(final Articolo articolo);
	void eliminaArticolo(final Articolo articolo);
	void aggiornaArticolo(final Articolo articolo);
	
	User getCurrentUser();
	
	void inserisciCategoria(final String nome, final String parent);
	void eliminaCategoria(final String nome, final String parent);
	void rinominaCategoria(final String vecchio, final String nuovo);
	List<Categoria> findCategorieByParent(final String parent);
	
	List<News> findAllNews();
	void inserisciNews(final News news);
	
	void richiediAcquisto(Articolo articolo, String email, String nome, String cognome);
}
